#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author: liang kang
@contact: gangkanli1219@163.com
@desc: 
"""
import argparse

from dltools.utils.log import get_console_logger

from utils.file_read import GoodsReader
from shelf.data.create_origin_tf_record import ShelfRecordGenerator


def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        '--root', type=str, default='', dest='root',
        help='The directory where the image data and the annotation is stored.'
             '保存图像与标记数据的根目录, 图像与其相应标记应当在同一级目录。')
    parser.add_argument(
        '--output', type=str, default='', dest='output',
        help='the root for all the output.'
             '输出结果的根目录')
    parser.add_argument(
        '--area', type=int, default=1000, dest='area',
        help='最小的货架像素数.')
    return parser.parse_args()


def origin_data_generate():
    recorder = ShelfRecordGenerator(reader, ARGS.output, area=ARGS.area,
                                    logger=logger)
    recorder.update()


if __name__ == '__main__':
    ARGS = parse_args()
    logger = get_console_logger('DataCreator')
    reader = GoodsReader(ARGS.root, logger)
    origin_data_generate()
